home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12019 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  3.6 KB

  1. Path: galaxy.ucr.edu!not-for-mail
  2. From: thp@cs.ucr.edu (Tom Payne)
  3. Newsgroups: comp.lang.c++,comp.lang.java
  4. Subject: Re: Java: What's the Big Deal?
  5. Followup-To: comp.lang.c++,comp.lang.java
  6. Date: 17 Mar 1996 20:55:26 GMT
  7. Organization: University of California, Riverside
  8. Message-ID: <4ihu7u$ogn@galaxy.ucr.edu>
  9. References: <4i40ik$9dt@news4.digex.net> <milodDo5yDE.H8B@netcom.com> <4if9jc$rkm@druid.borland.com> <milodDoF9JF.K32@netcom.com>
  10. NNTP-Posting-Host: corvette.ucr.edu
  11. X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
  12.  
  13. John DiCamillo (milod@netcom.com) wrote:
  14. : pete@borland.com (Pete Becker) writes:
  15. : >There's no reason you can't write a C++ compiler that generates a Java 
  16. : >bytestream.
  17. : Are you claiming that arbitrary, correct (ANSI) C++ code can
  18. : be compiled to the JVM and continue to work correctly?  Or are
  19. : you claiming that a compiler can be written that will translate
  20. : some limited subset of C++ into JVM?
  21. : And even if it is the former, given the limitations of the JVM,
  22. : I suspect that the performance characteristics of the resulting
  23. : program might be unrecognizable to the author.
  24.  
  25. There is no fundamental reason that g++, for instance, couldn't be
  26. targeted to JVM, just as it has been targeted to so many other
  27. architectures.  There may be some design features of JVM that make
  28. code generated for the non-Java features of C++ (e.g., pointers)
  29. particularly inefficient, but typically anything up to 10-to-1
  30. degredation is considered normal for such emulation.
  31.  
  32. : >>Other merely practical advantages (for certain kinds of apps)
  33. : >>include:
  34. : >>
  35. : >>1) Trade speed for safety (no pointer arithmetic + GC +
  36. : >>   all casts dynamically checked + array bounds + ...)
  37. : >>   This makes it a bit easier to program in than C++.
  38. : >Huh? Why can't you make these tradeoffs in C++? In fact, the problem is just 
  39. : >the opposite: you can't make these tradeoffs in Java because it does not let 
  40. : >you use pointers or handle your own memory management. This means you cannot 
  41. : >decide that speed is more important than safety.
  42. : Right, which was exactly my point.  The tradeoff has already
  43. : been made by the language in the right direction for certain
  44. : kinds of apps. Thus, there is less work for the programmer,
  45. : *assuming that you agree with the tradeoff*.
  46.  
  47. For C++ these are (mostly) implementation issues rather than language
  48. features.  Any implementation of C++ is free to make such tradeoffs,
  49. e.g., to include bounds checking, a garbage collector, etc.
  50.  
  51. : >>2) No header files => faster compilation
  52. : >Nonsense. Header files are simply text that gets included where you want it. If 
  53. : >you write the same code without header files it will not magically compile 
  54. : >faster.
  55. : It's not nonsense.  Cascaded #includes result in such a
  56. : drastic inflation of the source text that it makes a measurable
  57. : increase in compilation time.
  58.  
  59. That is an argument against using header files, or at least against
  60. using them in certain ways --- ways that are perhaps too common
  61. (but not directly required) in C++.
  62.  
  63.  
  64. In essence, Java is a P-code implementation of a (carefully chosen)
  65. subset of C++ with some librarys added.  It may be a major step
  66. forward in implementation and may point the way to a better
  67. programming style (e.g., pointerless).  
  68.  
  69. I'm very interested in the issue of just how satisfied programmers are
  70. with the expressiveness of Java, because being able to start freshmen
  71. with an interpreted implementation of a standardized, expressive,
  72. small subset of C++ (augmented with GC and bounds checking) is likely
  73. to make life easier both for them and for me.  I doubt, however, that
  74. I would select Java for a data structures class.
  75.  
  76. Tom Payne (thp@cs.ucr.edu)
  77.